#include <iostream>
#include"FibonacciHeap.cpp"

using namespace std;

class DataLoad
{
    public:
    unsigned int key1;
    FibonacciHeapNode<DataLoad>* pointerToHeapNode;

    DataLoad (int key)
    {
        this->key1 = key;
        this->pointerToHeapNode = NULL;
    }
};

int main()
{
    DataLoad** data = new DataLoad*[10000];
    FibonacciHeap<DataLoad>* heap = new FibonacciHeap<DataLoad>();
    for (int i=10000; i>=1; i--)
    {
        data[i-1] = new DataLoad (i);
        heap->insert(data[i-1], &(data[i-1]->key1), &(data[i-1]->pointerToHeapNode));
    }
    int minVal = 0;
    while (DataLoad* minLoad = heap->removeMin())
    {
        if (minVal%100 == 0 && minVal < 9999)
        {
            heap->decreaseKey(data[minVal+1]->pointerToHeapNode, minVal+1);
        }
        if (minVal <= minLoad->key1)
        {
            minVal = minLoad->key1;
        }
        else
        {
            cout<<"Fault";
        }
        cout<<"\t"<<minLoad->key1;
    }
    //DataLoad* data1 = new DataLoad(10);
    //DataLoad* data2 = new DataLoad(20);
    //DataLoad* data3 = new DataLoad(30);
    //DataLoad* data4 = new DataLoad(40);
    //DataLoad* data5 = new DataLoad(50);
    //DataLoad* data6 = new DataLoad(60);
    //DataLoad* data7 = new DataLoad(70);
    //DataLoad* data8 = new DataLoad(80);
    //DataLoad* data9 = new DataLoad(90);
    //DataLoad* data10 = new DataLoad(150);

    //FibonacciHeap<DataLoad>* heap = new FibonacciHeap<DataLoad>();

    //heap->insert(data1, &(data1->key1));
    //heap->insert(data2, &(data2->key1));
    //heap->insert(data3, &(data3->key1));
    //heap->insert(data4, &(data4->key1));
    //heap->insert(data5, &(data5->key1));
    //heap->insert(data6, &(data6->key1));
    //heap->insert(data7, &(data7->key1));
    //heap->insert(data8, &(data8->key1));
    //heap->insert(data9, &(data9->key1));
    //FibonacciHeapNode<DataLoad>* node;
    //heap->insert(data10, &(data10->key1), &node);
    //heap->displayBFS();

    ////heap->displayBFS();
    ////heap->decreaseKey(node, 9);
    ////heap->displayBFS();
    ////cout<<minR->key1;
    ////heap->displayBFS();
    ////minR = heap->removeMin();
    //cout<<"\n\n\nRemoveMin is "<<heap->removeMin()->key1;
    //heap->displayBFS();
    ////cout<<"\n\nAddress of node: "<<node;
    ////heap->decreaseKey(node, 9);
    ////cout<<"\n\nAddress of node after decrease Key: "<<node;
    ////heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();
    //cout<<"\n\nDecreaseKey Called for node notice change of address\n";
    //heap->decreaseKey(node, 3);
    //heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();
    ////cout<<"\n\nDecreaseKey Called for node notice change of address\n";
    ////heap->decreaseKey(node, 3);
    ////heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();
    //cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    //heap->displayBFS();

    ////heap->displayBFS();
    //cout<<"\n\nAddress of node after removing that Key: "<<node;
    ////heap->displayBFS();
    cout << "\n\nHello world!" << endl;
    int temp;
    cin>>temp;
    return 0;
}
